package com.xwj.myobject

import com.xwj.myclass.MyConnection
import org.apache.spark.SparkContext

/**
  * Created by thinkjoy on 2017/8/9.
  * 数据集
  */
object SimpleApplication{

  var spark:SparkContext=null

  def main(args: Array[String]): Unit = {
    spark=new MyConnection().connect()
    val data=Array(1,2,3,4,5)
    val distData=spark.parallelize(data)
    val sum=distData.reduce((a,b)=>a+b)
    println("相加结果:"+sum)

  }

}
